import { defineStore } from 'pinia'

export const useAccountStore = defineStore ('account',{
  state(){
    return{
        account:null,
        account2:null,
    }  
  },
  actions:{
    saveAccount(account){
        this.account = account
    },
    saveAccount2(account2){
        this.account2 = account2
    },
  },
  getters:{

  },
  persist: {
    enabled: true,
    strategies: [
        {
            key: 'account',
            storage: localStorage,
            // paths: ['account'],
        },
    ],
},
})

// const account = {
//   namespaced: true,
//   // 内存中
//   state: {
//       account: null,
//   },
//   mutations: {
//       SAVE_ACCOUNT(state, _account) {
//           state.account = _account // 保存内存
//       },
//   },
//   actions: {
//       saveAccount({ commit }, _account) {
//           commit('SAVE_ACCOUNT', _account)
//       },
//   },
//   getters: {
//       account: state => state.account,
//   },
// }
